<html lang="en">
<head>
    <meta charset="UTF-8">
    <meta name="viewport" content="width=device-width, initial-scale=1.0">
    <title>Document</title>
    <style>
        div{
            width: 200px;
            height: 200px;
            background-color: #f00;
            color:#fff;
            line-height: 200px;
            text-align: center;
            font-size: 20px;
        }
    </style>
</head>
<body>
    <button>点击我</button>
    <div>点击我</div>
    <script>
        var btn = document.querySelector('button');
        var div = document.querySelector('div');

        //绑定单击事件
        btn.onclick = function(e){
            console.log('button =>',e);
            console.log('btn this=>',this)
        }
        div.onclick = function(e){
            console.log('div =>',e)
        }
    </script>
</body>
</html>